<%include file="header.html"%>
<%include file="top.html"%>
<%include file="left.html"%>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="javascript:void(0);">服务器管理</a>
							</li>
							<li class="active"><a href="javascript:void(0);">管理服务器</a></li>
						</ul><!-- .breadcrumb -->
					</div>

					<div class="page-content">

							<div class="col-xs-12">
								<div class="alert alert-info">
									<i class="icon-hand-right"></i>

									<strong class="red">请注意：</strong><i class="icon-pencil bigger-120"></i> 为编辑，<i class="icon-trash bigger-120"></i> 为删除
									<button class="close" data-dismiss="alert">
										<i class="icon-remove"></i>
									</button>
								</div>
								<div class="table-header">&nbsp;&nbsp;&nbsp;&nbsp;</div>
								<div class="table-responsive">
									<table id="sample-table-2" class="table table-striped table-bordered table-hover">
										<thead>
											<tr>
												<th>服务器名称</th>
												<th>服务器标识</th>
												<th>所属游戏</th>
												<th>发布的平台</th>
												<th>发布的版本</th>
												<th>
													<i class="icon-folder-close bigger-110"></i>
													发布到线上的目录
												</th>

												<th>服务器ip</th>
												<th>服务器用户名</th>
												<th>服务器ssh登录端口</th>

												<th>操作</th>
											</tr>
										</thead>

										<tbody>
											<%foreach from=$serverList item=serverInfo%>
											<tr>
												<td><%$serverInfo.name%></td>
												<td><%$serverInfo.tag%></td>
												<td><%$serverInfo.gameName%></td>
												<td><%$serverInfo.platformsName%></td>
												<td><%$serverInfo.version%></td>
												<td><%$serverInfo.onlineServerDir%></td>
												<td><%$serverInfo.serverIp%></td>
												<td><%$serverInfo.serverUser%></td>
												<td><%$serverInfo.sshPort%></td>

												<td>
													<!--<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">-->
													<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">

														<a class="green" href="javascript:void(0);" onClick="formSubmit('editor', <%$serverInfo.id%>);" >
															<i class="icon-pencil bigger-130"></i>
														</a>

														<a class="red" href="javascript:void(0);" onClick="formSubmit('del', <%$serverInfo.id%>);" >
															<i class="icon-trash bigger-130"></i>
														</a>
													</div>
													<div class="visible-xs visible-sm hidden-md hidden-lg">
														<div class="inline position-relative">
															<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
																<i class="icon-caret-down icon-only bigger-120"></i>
															</button>

															<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																<li>
																	<a href="javascript:void(0);" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Edit">
																		<span class="green">
																			<i class="icon-edit bigger-120"></i>
																		</span>
																	</a>
																</li>

																<li>
																	<a href="javascript:void(0);" class="tooltip-error" data-rel="tooltip" title="" data-original-title="Delete">
																		<span class="red">
																			<i class="icon-trash bigger-120"></i>
																		</span>
																	</a>
																</li>
															</ul>
														</div>
													</div>
												</td>
											</tr>
											<%/foreach%>
										</tbody>
									</table>
									
								</div><!-- /.table-responsive -->
							</div><!-- /span -->

					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

		<script type="text/javascript">

			jQuery(function($) {
				var oTable1 = $('#sample-table-2').dataTable( {
				"aoColumns": [
			      { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false },
				  { "bSortable": false }
				] } );
			
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			})

			function formSubmit(type, serverId) {
				var param = {};
				param['mod'] = 'Publish';
				param['do'] = 'serverModify';
				param['serverId'] = serverId;
				param['type'] = type;

				if (type == 'editor') {
					window.location.href = "index.php?mod=Publish&do=showServerEditor&serverId=" + serverId;
				} else {

					$.ajax({
						type:'POST',
						url:'index.php',
						data:param,
						dataType:'html',
						success:function(data) {
							var dataObj = eval("(" + data + ")");//转换为json对象
							if(dataObj.code == 1) {
								alert(dataObj.msg);
								window.location.href = "index.php?mod=Publish&do=showServerList";
							} else {
								alert(dataObj.msg);
							}
						}
					});
				}
			}
		</script>
<%include file="footer.html"%>

